#服务端
import socket
import traceback
if __name__ == '__main__':
    st=socket.socket()
    st.bind(("192.168.100.85",8888))
    st.listen(10)
    while True:
        s,addr=st.accept()
        print("本次连接的地址信息：", addr)
        try:
            while True:
                msg=s.recv(2048).decode()
                print(addr,",发来了信息：",msg)
                s.sendall(("你的折子【"+str(msg)+"】，朕知道了").encode())
                if msg=="exit":
                    break
        except Exception as e:
            traceback.print_exc()
            print("异常信息：",e)
        finally:
            if s:
                s.close()
        #a,b=(1,2)
